Skip to content

Conversation

tonnico
Copy link
Contributor

@tonnico tonnico commented Sep 22, 2025

Issue number: closes #7342

Summary

Changes

  • remove single value from _parse_form_data
  • create single value from lists for non-sequence values

User experience

Please share what the user experience looks like before and after this change


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@tonnico tonnico requested a review from a team as a code owner September 22, 2025 20:20
@tonnico tonnico requested a review from anafalcao September 22, 2025 20:20
@pull-request-size pull-request-size bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Sep 22, 2025
Copy link

codecov bot commented Sep 23, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.42%. Comparing base (d725d9d) to head (690a899).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #7415      +/-   ##
===========================================
+ Coverage    96.37%   96.42%   +0.04%     
===========================================
  Files          275      275              
  Lines        13048    13055       +7     
  Branches       974      974              
===========================================
+ Hits         12575    12588      +13     
+ Misses         366      362       -4     
+ Partials       107      105       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dreamorosi dreamorosi assigned dreamorosi and tonnico and unassigned dreamorosi Sep 23, 2025
@dreamorosi
Copy link
Contributor

Hi @tonnico, thank you for the PR!

The static analysis shows a warning on the function touched by the changes. With the new additions, the cognitive complexity of the function went up because of the excessive branching logic.

Would it be possible to refactor it and reduce it?

Thank you.

Copy link
Contributor

@dreamorosi dreamorosi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comment above about reducing cognitive complexity and address the SonarCloud issue.

Let us know if you have any questions.

@dreamorosi dreamorosi removed the request for review from anafalcao September 23, 2025 07:13
Copy link
Contributor

@leandrodamascena leandrodamascena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @tonnico thanks a lot for sending this PR. What do you think about adding a test with a field that is annotated as a list but contains only a single value when submitted?! Idk if we have this test and this was the cause of this issue.

Pls let me know what do you think.

@pull-request-size pull-request-size bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Sep 23, 2025
@tonnico
Copy link
Contributor Author

tonnico commented Sep 23, 2025

See my comment above about reducing cognitive complexity and address the SonarCloud issue.

Let us know if you have any questions.

I refactored the function.
I also find some duplicated code in _request_params_to_args.
Finally i sort some variables so that _request_params_to_args and _request_body_to_args looks like more the same.

@github-actions github-actions bot added the bug Something isn't working label Sep 23, 2025
@dreamorosi dreamorosi dismissed their stale review September 24, 2025 08:14

With the CI being green and SonarCloud clear, I'm leaving the final review to @leandrodamascena.

@dreamorosi dreamorosi requested review from leandrodamascena and removed request for dreamorosi and leandrodamascena September 24, 2025 08:14
@dreamorosi
Copy link
Contributor

Hi @tonnico, thank you for addressing the review feedback - @leandrodamascena will review this tomorrow or Friday at the latest.

Thank you for your patience and contribution!

@leandrodamascena leandrodamascena changed the title fix: parse single list items in form data fix(event_handler): parse single list items in form data Sep 25, 2025
@leandrodamascena
Copy link
Contributor

I'm reviewing it now! I see some errors in CI related to the glide library, probably because I merged a PR today morning. Let me see what's going on.

Copy link

Copy link
Contributor

@leandrodamascena leandrodamascena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @tonnico! Sorry for the slight delay in reviewing, but this PR is really awesome! Nothing to change, thank you very much for reducing the code complexity by moving some of the logic into separate functions.

APPROVED!

@leandrodamascena leandrodamascena merged commit 8f1c683 into aws-powertools:develop Sep 29, 2025
14 checks passed
@bdellegrazie
Copy link

@tonnico - thank you for fixing this - much appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working event_handlers size/L Denotes a PR that changes 100-499 lines, ignoring generated files. tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Form() field does not handle list parameters

4 participants